<%@ page import="java.util.ArrayList" %>
<%@ page import="Login.entity.Book" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>书本信息</title>
    <style>
        table{
            width: 400px;
            border: 1px solid #000;
            border-collapse:collapse;
            margin: auto;
        }
        td,th{
            border: 1px solid #000;
            text-align: center;
        }
    </style>
</head>
<body>
<a href="add.jsp">添加</a>
<table>
    <tr>
        <th>书本Id</th>
        <th>书名</th>
        <th>书本状态</th>
        <th>修改</th>
        <th>删除</th>
    </tr>
    <%
        ArrayList<Book> list = (ArrayList<Book>) request.getAttribute("list");
        for (Book book:list) {
    %>
    <tr>
        <td><%=book.getBookId()%></td>
        <td><%=book.getBookName()%></td>
        <td><%=book.getBookStatus()%></td>
        <td><a href="edit?id=<%=book.getBookId()%>">修改</a></td>
        <td><a href="del?id=<%=book.getBookId()%>" onclick="return confirm('是否确认删除？')">删除</a></td>
    </tr>
    <%
        }
    %>
<%--    <c:forEach items="${list}" var="book">--%>
<%--        <tr>--%>
<%--            <td>${book.bookId}</td>--%>
<%--            <td>${book.bookName}</td>--%>
<%--            <td>${book.bookStatus}</td>--%>
<%--            <td><a href="edit?id=${book.bookId}">修改</a></td>--%>
<%--            <td><a href="del?id=${book.bookId}" onclick="return confirm('确认要删除？？')">删除</a></td>--%>
<%--        </tr>--%>
<%--    </c:forEach>--%>
</table>

</body>
</html>
